Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce universes to NLL type check #52488

Merged
merged 31 commits into from
Jul 26, 2018

Conversation

nikomatsakis
Copy link
Contributor

This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker.

This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071.

At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the relate_tys trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work.

r? @pnkfelix -- but I want to measure perf etc first

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 18, 2018
@nikomatsakis
Copy link
Contributor Author

Ah, shoot, the conflicts here are a bit "deep-ish". Have to think about best way to resolve.

@nikomatsakis
Copy link
Contributor Author

@bors try

still, I think we can do a try run to measure perf...

@bors
Copy link
Contributor

bors commented Jul 18, 2018

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout nll-issue-48071-universe-and-sub (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self nll-issue-48071-universe-and-sub --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging src/librustc_mir/borrow_check/nll/type_check/mod.rs
CONFLICT (content): Merge conflict in src/librustc_mir/borrow_check/nll/type_check/mod.rs
Auto-merging src/librustc_mir/borrow_check/nll/region_infer/values.rs
CONFLICT (content): Merge conflict in src/librustc_mir/borrow_check/nll/region_infer/values.rs
Auto-merging src/librustc_mir/borrow_check/nll/region_infer/mod.rs
CONFLICT (content): Merge conflict in src/librustc_mir/borrow_check/nll/region_infer/mod.rs
Auto-merging src/librustc_data_structures/bitvec.rs
Automatic merge failed; fix conflicts and then commit the result.

@nikomatsakis nikomatsakis force-pushed the nll-issue-48071-universe-and-sub branch from a31fc70 to 512352b Compare July 18, 2018 18:53
@nikomatsakis
Copy link
Contributor Author

@bors try

@bors
Copy link
Contributor

bors commented Jul 18, 2018

⌛ Trying commit 512352b28d257e64278b447319561185c1f6edb1 with merge b5045d96d659e3aa4c727f44caf5362cc6116be3...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_mir-opt
Check compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:55:03] 
[00:55:03] running 51 tests
[00:55:14] ERROR 2018-07-18T19:51:29Z: compiletest::runtest: None
[00:55:23] .................................F.................
[00:55:23] 
[00:55:23] ---- [mir-opt] mir-opt/nll/named-lifetimes-basic.rs stdout ----
[00:55:23] ---- [mir-opt] mir-opt/nll/named-lifetimes-basic.rs stdout ----
[00:55:23] thread '[mir-opt] mir-opt/nll/named-lifetimes-basic.rs' panicked at 'Did not find expected line, error: Mismatch in lines
[00:55:23] Current block: None
[00:55:23] Actual Line: "| \'_#0r    | {bb0[0..=1], \'_#0r}"
[00:55:23] Expected Line: "| \'_#0r    | {\'_#0r, bb0[0..=1]}"
[00:55:23] Test Name: rustc.use_x.nll.0.mir
[00:55:23] Expected:
[00:55:23] ... (elided)
[00:55:23] | Free Region Mapping
[00:55:23] | '_#0r    | Global   | ['_#2r, '_#1r, '_#0r, '_#4r, '_#3r]
[00:55:23] | '_#1r    | External | ['_#1r, '_#4r]
[00:55:23] | '_#2r    | External | ['_#2r, '_#1r, '_#4r]
[00:55:23] | '_#3r    | Local    | ['_#4r, '_#3r]
[00:55:23] | '_#4r    | Local    | ['_#4r]
[00:55:23] | Inferred Region Values
[00:55:23] | Inferred Region Values
[00:55:23] | '_#0r    | {'_#0r, bb0[0..=1]}
[00:55:23] | '_#1r    | {'_#1r, bb0[0..=1]}
[00:55:23] | '_#2r    | {'_#2r, bb0[0..=1]}
[00:55:23] | '_#3r    | {'_#3r, bb0[0..=1]}
[00:55:23] | '_#4r    | {'_#4r, bb0[0..=1]}
[00:55:23] | '_#5r    | {'_#1r, bb0[0..=1]}
[00:55:23] | '_#6r    | {'_#2r, bb0[0..=1]}
[00:55:23] | '_#7r    | {'_#1r, bb0[0..=1]}
[00:55:23] | '_#8r    | {'_#3r, bb0[0..=1]}
[00:55:23] |
[00:55:23] ... (elided)
[00:55:23] fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool {
[00:55:23] Actual:
[00:55:23] | Free Region Mapping
[00:55:23] | '_#0r    | Global   | ['_#2r, '_#1r, '_#0r, '_#4r, '_#3r]
[00:55:23] | '_#1r    | External | ['_#1r, '_#4r]
[00:55:23] | '_#2r    | External | ['_#2r, '_#1r, '_#4r]
[00:55:23] | '_#3r    | Local    | ['_#4r, '_#3r]
[00:55:23] | '_#4r    | Local    | ['_#4r]
[00:55:23] | Inferred Region Values
[00:55:23] | Inferred Region Values
[00:55:23] | '_#0r    | {bb0[0..=1], '_#0r}
[00:55:23] | '_#1r    | {bb0[0..=1], '_#1r}
[00:55:23] | '_#2r    | {bb0[0..=1], '_#2r}
[00:55:23] | '_#3r    | {bb0[0..=1], '_#3r}
[00:55:23] | '_#4r    | {bb0[0..=1], '_#4r}
[00:55:23] | '_#5r    | {bb0[0..=1], '_#1r}
[00:55:23] | '_#6r    | {bb0[0..=1], '_#2r}
[00:55:23] | '_#7r    | {bb0[0..=1], '_#1r}
[00:55:23] | '_#8r    | {bb0[0..=1], '_#3r}
[00:55:23] | Inference Constraints
[00:55:23] | Inference Constraints
[00:55:23] | '_#0r live at {bb0[0..=1], '_#0r}
[00:55:23] | '_#1r live at {bb0[0..=1], '_#1r}
[00:55:23] | '_#2r live at {bb0[0..=1], '_#2r}
[00:55:23] | '_#3r live at {bb0[0..=1], '_#3r}
[00:55:23] | '_#4r live at {bb0[0..=1], '_#4r}
[00:55:23] | '_#1r: '_#5r due to All
[00:55:23] | '_#1r: '_#7r due to All
[00:55:23] | '_#2r: '_#6r due to All
[00:55:23] | '_#3r: '_#8r due to All
[00:55:23] | '_#5r: '_#1r due to All
[00:55:23] | '_#6r: '_#2r due to All
[00:55:23] | '_#7r: '_#1r due to All
[00:55:23] | '_#8r: '_#3r due to All
[00:55:23] fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool{
[00:55:23]     let mut _0: bool;
[00:55:23]     bb0: {                              
[00:55:23]                                          | Live variables on entry to bb0[0]: []
[00:55:23]         _0 = const true;
[00:55:23]                                          | Live variables on entry to bb0[1]: []
[00:55:23]         return;
[00:55:23]     | Live variables on exit from bb0: []
[00:55:23] }', tools/compiletest/src/runtest.rs:2815:13
[00:55:23] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:55:23] 
[00:55:23] 
---
[00:55:23] 
[00:55:23] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:55:23] 
[00:55:23] 
[00:55:23] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/mir-opt" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/mir-opt" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "mir-opt" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:55:23] 
[00:55:23] 
[00:55:23] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:55:23] Build completed unsuccessfully in 0:10:13
[00:55:23] Build completed unsuccessfully in 0:10:13
[00:55:23] Makefile:58: recipe for target 'check' failed
[00:55:23] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2f07b67c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:00c96990:start=1531943500378562483,finish=1531943500385241510,duration=6679027
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:15a56886
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:2b511bec
travis_time:start:2b511bec
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:055783a7
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jul 18, 2018

☀️ Test successful - status-travis
State: approved= try=True

@kennytm
Copy link
Member

kennytm commented Jul 18, 2018

@rust-timer build b5045d96d659e3aa4c727f44caf5362cc6116be3

@rust-timer
Copy link
Collaborator

Success: Queued b5045d96d659e3aa4c727f44caf5362cc6116be3 with parent 12ed235, comparison URL.

@kennytm kennytm added S-waiting-on-perf Status: Waiting on a perf run to be completed. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 18, 2018
@kennytm
Copy link
Member

kennytm commented Jul 19, 2018

Perf is ready. Tuple-stress is extremely slowed down (+50%), and also html5ever (+7%). OTOH coercions (-10%) and clap (-8%) are improved a lot.

@nikomatsakis
Copy link
Contributor Author

Interesting. I'll have to check out tuple-stress.

@nikomatsakis
Copy link
Contributor Author

Curious. I cannot reproduce this. Although I think my build is from before the rebase. Let me try again.

@nikomatsakis
Copy link
Contributor Author

After building the rebased variants, I get even more inexplicable results -- master takes 3x as long!

@nikomatsakis nikomatsakis force-pushed the nll-issue-48071-universe-and-sub branch from c21fcc4 to fecaf75 Compare July 21, 2018 14:05
@bors
Copy link
Contributor

bors commented Jul 22, 2018

☔ The latest upstream changes (presumably #52250) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis nikomatsakis force-pushed the nll-issue-48071-universe-and-sub branch 2 times, most recently from d0ee8a4 to 52f8563 Compare July 23, 2018 15:28
@nikomatsakis nikomatsakis force-pushed the nll-issue-48071-universe-and-sub branch 2 times, most recently from 55902e6 to 0ec92e3 Compare July 24, 2018 20:16
This way, we can iterate over a `Range<T>` where `T: Idx`
@nikomatsakis nikomatsakis force-pushed the nll-issue-48071-universe-and-sub branch 2 times, most recently from b0ef341 to 870efb1 Compare July 24, 2018 21:24
@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 26, 2018
@kennytm
Copy link
Member

kennytm commented Jul 26, 2018

Perf is ready.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/1c/95/6bf862d284c9117eb50b3832cf39780248744e2bda3bbbcd9c5f12c489bf/awscli-1.15.65-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 14.0MB/s eta 0:00:01
    1% |▌                               | 20kB 1.9MB/s eta 0:00:01
    2% |▊                               | 30kB 2.2MB/s eta 0:00:01
    3% |█                               | 40kB 2.0MB/s eta 0:00:01
---
[00:55:08] ....................................................................................i...............
[00:55:11] .............................i......................................................................
[00:55:15] ....................................................................................................
[00:55:18] ........................................................i...........................................
[00:55:21] ...............................................FF.F....i..ii........................................
[00:55:27] ....................................................................................................
[00:55:30] ....................................................................................................
[00:55:32] .......................................i............................................................
[00:55:35] ....................................................................................................
[00:55:35] ....................................................................................................
[00:55:38] ....................................................................................................
[00:55:41] ....................................................................................................
[00:55:43] .....................................................................................
[00:55:43] failures:
[00:55:43] 
[00:55:43] ---- [compile-fail] compile-fail/mir_check_cast_reify.rs stdout ----
[00:55:43] 
[00:55:43] error: /checkout/src/test/compile-fail/mir_check_cast_reify.rs:49: unexpected error: '49:5: 49:9: borrowed data escapes outside of closure'
[00:55:43] 
[00:55:43] error: /checkout/src/test/compile-fail/mir_check_cast_reify.rs:46: expected error not found: unsatisfied lifetime constraints
[00:55:43] error: 1 unexpected errors found, 1 expected errors not found
[00:55:43] status: exit code: 1
[00:55:43] status: exit code: 1
[00:55:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/st not found: unsatisfied lifetime constraints
[00:55:43] error: 1 unexpected errors found, 1 expected errors not found
[00:55:43] status: exit code: 1
[00:55:43] status: exit code: 1
[00:55:43] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/compile-fail/mir_check_cast_unsafe_fn.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/mir_check_cast_unsafe_fn/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Zborrowck=mir" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/mir_check_cast_unsafe_fn/auxiliary" "-A" "unused"
[00:55:43]     Error {
[00:55:43]         line_num: 21,
[00:55:43]         kind: Some(
[00:55:43]             Error
[00:55:43]             Error
[00:55:43]         ),
[00:55:43]         msg: "21:14: 21:22: borrowed data escapes outside of closure"
[00:55:43] ]
[00:55:43] 
[00:55:43] not found errors (from test file): [
[00:55:43]     Error {
---
[00:55:43] thread '[compile-fail] compile-fail/mir_check_cast_unsafe_fn.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1285:13
[00:55:43] 
[00:55:43] ---- [compile-fail] compile-fail/mir_check_cast_unsize.rs stdout ----
[00:55:43] 
[00:55:43] error: llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:55:43] 
[00:55:43] 
[00:55:43] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:55:43] Build completed unsuccessfully in 0:09:24
[00:55:43] Build completed unsuccessfully in 0:09:24
[00:55:43] make: *** [check] Error 1
[00:55:43] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:218024a8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@nikomatsakis
Copy link
Contributor Author

OK so perf looks great. Now just gotta fix the last trailing errors.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/1c/95/6bf862d284c9117eb50b3832cf39780248744e2bda3bbbcd9c5f12c489bf/awscli-1.15.65-py2.py3-none-any.whl (1.3MB)
    0% |▎                               | 10kB 1.8MB/s eta 0:00:01
    1% |▌                               | 20kB 1.1MB/s eta 0:00:02
    2% |▊                               | 30kB 1.2MB/s eta 0:00:02
    3% |█                               | 40kB 1.2MB/s eta 0:00:02
---
travis_time:start:test_mir-opt
Check compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:49:36] 
[00:49:36] running 46 tests
[00:49:44] ERROR 2018-07-26T07:21:49Z: compiletest::runtest: None
[00:49:54] .............................FFF..............
[00:49:54] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:49:54] 
[00:49:54] ---- [mir-opt] mir-opt/nll/named-lifetimes-basic.rs stdout ----
[00:49:54] ---- [mir-opt] mir-opt/nll/named-lifetimes-basic.rs stdout ----
[00:49:54] thread '[mir-opt] mir-opt/nll/named-lifetimes-basic.rs' panicked at 'Did not find expected line, error: Mismatch in lines
[00:49:54] Current block: None
[00:49:54] Actual Line: "| \'_#0r    | U0 | {bb0[0..=127], \'_#0r}"
[00:49:54] Expected Line: "| \'_#0r    | {\'_#0r, bb0[0..=1]}"
[00:49:54] Test Name: rustc.use_x.nll.0.mir
[00:49:54] Expected:
[00:49:54] ... (elided)
[00:49:54] | Free Region Mapping
[00:49:54] | '_#0r    | Global   | ['_#2r, '_#1r, '_#0r, '_#4r, '_#3r]
[00:49:54] | '_#1r    | External | ['_#1r, '_#4r]
[00:49:54] | '_#2r    | External | ['_#2r, '_#1r, '_#4r]
[00:49:54] | '_#3r    | Local    | ['_#4r, '_#3r]
[00:49:54] | '_#4r    | Local    | ['_#4r]
[00:49:54] | Inferred Region Values
[00:49:54] | Inferred Region Values
[00:49:54] | '_#0r    | {'_#0r, bb0[0..=1]}
[00:49:54] | '_#1r    | {'_#1r, bb0[0..=1]}
[00:49:54] | '_#2r    | {'_#2r, bb0[0..| '_#3r: '_#8r due to All
[00:49:54] | '_#5r: '_#1r due to All
[00:49:54] | '_#6r: '_#2r due to All
[00:49:54] | '_#7r: '_#1r due to All
[00:49:54] | '_#8r: '_#3r due to All
[00:49:54] fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool{
[00:49:54]     let mut _0: bool;
[00:49:54]     bb0: {                              
[00:49:54]                                          | Live variables on entry to bb0[0]: []
[00:49:54]         _0 = const true;
[00:49:54]                                          | Live variables on entry to bb0[1]: []
[00:49:54]         return;
[00:49:54]     | Live variables on exit from bb0: []
[00:49:54] }', tools/compiletest/src/runtest.rs:2817:13
[00:49:54] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:49:54] 
[00:49:54] ---- [mir-opt] mir-opt/nll/reborrow-basic.rs stdout ----
[00:49:54] ---- [mir-opt] mir-opt/nll/reborrow-basic.rs stdout ----
[00:49:54] thread '[mir-opt] mir-opt/nll/reborrow-basic.rs' panicked at 'Did not find expected line, error: ran out of mir dump to match against
[00:49:54] Expected Line: "| \'_#7r    | {bb0[4], bb0[8..=17]}"
[00:49:54] Test Name: rustc.main.nll.0.mir
[00:49:54] Expected:
[00:49:54] ... (elided)
[00:49:54] | '_#7r    | {bb0[4], bb0[8..=17]}
[00:49:54] ... (elided)
[00:49:54] | '_#9r    | {bb0[10], bb0[14..=17]}
[00:49:54] ... (elided)
[00:49:54] let _4: &'_#9r mut i32;
[00:49:54] ... (elided)
[00:49:54] let _2: &'_#7r mut i32;
[00:49:54] Actual:
[00:49:54] | Free Region Mapping
[00:49:54] | '_#0r    | Global   | ['_#0r, '_#1r]
[00:49:54] | '_#1r    | Local    | ['_#1r]
[00:49:54] | Inferred Region Values
[00:49:54] | Inferred Region Values
[00:49:54] | '_#0r [00:49:54] | '_#3r live at {bb2[1..=2]}
[00:49:54] | '_#4r live at {bb2[3], bb3[0..=1]}
[00:49:54] | '_#2r: '_#3r due to Interesting(bb2[0])
[00:49:54] | '_#3r: '_#4r due to Interesting(bb2[2])
[00:49:54] fn main() -> (){
[00:49:54]     let mut _0: ();
[00:49:54]     scope 1 {
[00:49:54]         scope 3 {
[00:49:54]             scope 5 {
[00:49:54]             scope 6 {
[00:49:54]             scope 6 {
[00:49:54]                 let _6: &'_#4r usize;
[00:49:54]         }
[00:49:54]         scope 4 {
[00:49:54]         scope 4 {
[00:49:54]             let _2: &'_#3r usize;
[00:49:54]     }
[00:49:54]     scope 2 {
[00:49:54]     scope 2 {
[00:49:54]         let mut _1: [usize; 3];
[00:49:54]     let mut _3: usize;
[00:49:54]     let mut _4: usize;
[00:49:54]     let mut _4: usize;
[00:49:54]     let mut _5: bool;
[00:49:54]     let mut _7: bool;
[00:49:54]     let mut _8: usize;
[00:49:54]     let mut _9: bool;
[00:49:54]     bb0: {                              
[00:49:54]                                          | Live variables on entry to bb0[0]: []
[00:49:54]         StorageLive(_1);
[00:49:54]                                          | Live variables on entry to bb0[1]: []
[00:49:54]         _1 = [const 1usize, const 2usize, const 3usize];
[00:49:54]                                          | Live variables on entry to bb0[2]: []
[00:49:54]         StorageLive(_2);
[00:49:54]                                          | Live variables on entry to bb0[3]: []
[00:49:54]         StorageLive(_3);
[00:49:54]                                          | Live variables on entry to bb0[4]: []
[00:49:54]         _3 = const 0usize;                                    | Live variables on entry to bb3[1]: [1]
[00:49:54]         _8 = (*_6);
[00:49:54]                                          | Live variables on entry to bb3[2]: []
[00:49:54]         _7 = const use_x(move _8) -> [return: bb5, unwind: bb1];
[00:49:54]     | Live variables on exit from bb3: []
[00:49:54]     }
[00:49:54]     bb4: {                              
[00:49:54]                                          | Live variables on entry to bb4[0]: []
[00:49:54]         _9 = const use_x(const 22usize) -> [return: bb6, unwind: bb1];
[00:49:54]     | Live variables on exit from bb4: []
[00:49:54]     }
[00:49:54]     bb5: {                              
[00:49:54]                                          | Live variables on entry to bb5[0]: []
[00:49:54]         StorageDead(_8);
[00:49:54]                                          | Live variables on entry to bb5[1]: []
[00:49:54]         _0 = ();
[00:49:54]                                          | Live variables on entry to bb5[2]: []
[00:49:54]         goto -> bb7;
[00:49:54]     | Live variables on exit from bb5: []
[00:49:54]     }
[00:49:54]     bb6: {                              
[00:49:54]                                          | Live variables on entry to bb6[0]: []
[00:49:54]         _0 = ();
[00:49:54]                                          | Live variables on entry to bb6[1]: []
[00:49:54]         goto -> bb7;
[00:49:54]     | Live variables on exit from bb6: []
[00:49:54]     }
[00:49:54]     bb7: {                              
[00:49:54]                                          | Live variables on

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[01:07:26] travis_fold:start:test_stage1-rustc_data_structures
travis_time:start:test_stage1-rustc_data_structures
Testing rustc_data_structures stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:07:26]    Compiling rustc_data_structures v0.0.0 (file:///checkout/src/librustc_data_structures)
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:415:22
[01:07:27]     |
[01:07:27] 415 |     let mut bitvec = BitVector::new(100);
[01:07:27]     |                      ^^^^^^^^^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27]     |
[01:07:27] note: required by `<bitvec::BitVector<C>>::new`
[01:07:27]    --> librustc_data_structures/bitvec.rs:27:5
[01:07:27]     |
[01:07:27] 27  |     pub fn new(num_bits: usize) -> BitVector<C> {
[01:07:27] 
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:416:12
[01:07:27] 416 |     bitvec.insert(1);
[01:07:27] 416 |     bitvec.insert(1);
[01:07:27]     |            ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:417:12
[01:07:27] 417 |     bitvec.insert(10);
[01:07:27] 417 |     bitvec.insert(10);
[01:07:27]     |            ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:433:22
[01:07:27]     |
[01:07:27] 433 |     let mut bitvec = BitVector::new(319);
[01:07:27]     |                      ^^^^^^^^^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27]     |
[01:07:27] note: required by `<bitvec::BitVector<C>>::new`
[01:07:27]    --> librustc_data_structures/bitvec.rs:27:5
[01:07:27]     |
[01:07:27] 27  |     pub fn new(num_bits: usize) -> BitVector<C> {
[01:07:27] 
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:434:12
[01:07:27] 434 |     bitvec.insert(0);
[01:07:27] 434 |     bitvec.insert(0);
[01:07:27]     |            ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:435:12
[01:07:27] 435 |     bitvec.insert(127);
[01:07:27] 435 |     bitvec.insert(127);
[01:07:27]     |            ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:444:20
[01:07:27]     |
[01:07:27] 444 |     let mut vec1 = BitVector::new(65);
[01:07:27]     |                    ^^^^^^^^^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27]     |
[01:07:27] note: required by `<bitvec::BitVector<C>>::new`
[01:07:27]    --> librustc_data_structures/bitvec.rs:27:5
[01:07:27]     |
[01:07:27] 27  |     pub fn new(num_bits: usize) -> BitVector<C> {
[01:07:27] 
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:445:20
[01:07:27]     |
[01:07:27] 445 |     let mut vec2 = BitVector::new(65);
[01:07:27]     |                    ^^^^^^^^^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27]     |
[01:07:27] note: required by `<bitvec::BitVector<C>>::new`
[01:07:27]    --> librustc_data_structures/bitvec.rs:27:5
[01:07:27]     |
[01:07:27] 27  |     pub fn new(num_bits: usize) -> BitVector<C> {
[01:07:27] 
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:446:18
[01:07:27]     |
[01:07:27] 446 |     assert!(vec1.insert(3));
[01:07:27]     |                  ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:447:19
[01:07:27]     |
[01:07:27] 447 |     assert!(!vec1.insert(3));
[01:07:27]     |                   ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:448:18
[01:07:27]     |
[01:07:27] 448 |     assert!(vec2.insert(5));
[01:07:27]     |                  ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:449:18
[01:07:27]     |
[01:07:27] 449 |     assert!(vec2.insert(64));
[01:07:27]     |                  ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:461:20
[01:07:27]     |
[01:07:27] 461 |     let mut vec1 = BitVector::new(65);
[01:07:27]     |                    ^^^^^^^^^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27]     |
[01:07:27] note: required by `<bitvec::BitVector<C>>::new`
[01:07:27]    --> librustc_data_structures/bitvec.rs:27:5
[01:07:27]     |
[01:07:27] 27  |     pub fn new(num_bits: usize) -> BitVector<C> {
[01:07:27] 
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:463:22
[01:07:27]     |
[01:07:27] 463 |         assert!(vec1.insert(index));
[01:07:27]     |                      ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:464:23
[01:07:27]     |
[01:07:27] 464 |         assert!(!vec1.insert(index));
[01:07:27]     |                       ^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:487:20
[01:07:27]     |
[01:07:27] 487 |     let mut vec1 = BitMatrix::new(200, 200);
[01:07:27]     |                    ^^^^^^^^^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27]     |
[01:07:27] note: required by `<bitvec::BitMatrix<R, C>>::new`
[01:07:27]    --> librustc_data_structures/bitvec.rs:202:5
[01:07:27]     |
[01:07:27] 202 |     pub fn new(rows: usize, columns: usize) -> BitMatrix<R, C> {
[01:07:27] 
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:491:10
[01:07:27]     |
[01:07:27] 491 |     vec1.add(2, 3);
[01:07:27]     |          ^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:492:10
[01:07:27]     |
[01:07:27] 492 |     vec1.add(2, 6);
[01:07:27]     |          ^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:518:22
[01:07:27]     |
[01:07:27] 518 |     let mut matrix = BitMatrix::new(64, 100);
[01:07:27]     |                      ^^^^^^^^^^^^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27]     |
[01:07:27] note: required by `<bitvec::BitMatrix<R, C>>::new`
[01:07:27]    --> librustc_data_structures/bitvec.rs:202:5
[01:07:27]     |
[01:07:27] 202 |     pub fn new(rows: usize, columns: usize) -> BitMatrix<R, C> {
[01:07:27] 
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:519:12
[01:07:27]     |
[01:07:27] 519 |     matrix.add(3, 22);
[01:07:27]     |            ^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] 
[01:07:27] error[E0277]: the trait bound `i32: indexed_vec::Idx` is not satisfied
[01:07:27]    --> librustc_data_structures/bitvec.rs:520:12
[01:07:27]     |
[01:07:27] 520 |     matrix.add(3, 75);
[01:07:27]     |            ^^^ the trait `indexed_vec::Idx` is not implemented for `i32`
[01:07:27] error[E0061]: this function takes 1 parameter but 2 parameters were supplied
[01:07:27]    --> librustc_data_structures/bitvec.rs:560:22
[01:07:27]     |
[01:07:27]     |
[01:07:27] 316 |     pub fn new(columns: usize) -> Self {
[01:07:27]     |     ---------------------------------- defined here
[01:07:27] ...
[01:07:27] 560 |     let mut matrix = SparseBitMatrix::new(64, 100);
[01:07:27] 
[01:07:29] error: aborting due to 22 previous errors
[01:07:29] 
[01:07:29] Some errors occurred: E0061, E0277.
[01:07:29] Some errors occurred: E0061, E0277.
[01:07:29] For more information about an error, try `rustc --explain E0061`.
[01:07:29] error: Could not compile `rustc_data_structures`.
[01:07:29] 
[01:07:29] To learn more, run the command again with --verbose.
[01:07:29] 
[01:07:29] 
[01:07:29] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "-p" "rustc_data_structures" "--" "--quiet"
[01:07:29] 
[01:07:29] 
[01:07:29] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:07:29] Build completed unsuccessfully in 0:25:48
[01:07:29] Build completed unsuccessfully in 0:25:48
[01:07:29] make: *** [check] Error 1
[01:07:29] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0867720c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
145440 ./obj/build/bootstrap/debug/incremental
135292 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu
135288 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release
130572 ./obj/build/bootstrap/debug/incremental/bootstrap-2fbxwhl9tnp02
130568 ./obj/build/bootstrap/debug/incremental/bootstrap-2fbxwhl9tnp02/s-f39i4rcgif-5f1cst-2rpcqp3yi7261
128708 ./obj/build/x8665416 ./src/llvm-emscripten/test/CodeGen
64668 ./obj/build/x86_64-unknown-linux-gnu/doc/std
60840 ./src/llvm-emscripten/lib
58756 ./obj/build/x86_64-unknown-linux-gnu/stage2-tools

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@nikomatsakis
Copy link
Contributor Author

@bors r=pnkfelix p=1

Resolves a major ICE for NLL, EP2 blocker.

@bors
Copy link
Contributor

bors commented Jul 26, 2018

📌 Commit ce576ac has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 26, 2018
@Mark-Simulacrum
Copy link
Member

@bors p=10

@bors
Copy link
Contributor

bors commented Jul 26, 2018

⌛ Testing commit ce576ac with merge bfbf837...

bors added a commit that referenced this pull request Jul 26, 2018
… r=pnkfelix

introduce universes to NLL type check

This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker.

This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071.

At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work.

r? @pnkfelix -- but I want to measure perf etc first
@bors
Copy link
Contributor

bors commented Jul 26, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: pnkfelix
Pushing bfbf837 to master...

@bors bors merged commit ce576ac into rust-lang:master Jul 26, 2018
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jul 27, 2018
revert accidental atty downgrade

This got accidentally downgraded by rust-lang#52488

Cc @nikomatsakis @pnkfelix
kennytm added a commit to kennytm/rust that referenced this pull request Jul 28, 2018
revert accidental atty downgrade

This got accidentally downgraded by rust-lang#52488

Cc @nikomatsakis @pnkfelix
@lqd lqd mentioned this pull request Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE bootstrapping rustc with NLL enabled
8 participants